#include "processBar.h"

char bar[NUM]={0};
void processbar(int cnt)
{
    const char *ch="|/-\\";

    memset(bar,BODY,cnt);
    bar[cnt]=TOP;
    while(cnt <= END)
    {
        int len=strlen(bar);
        printf(GREEN"[%-100s]"NOND"[%d%%][%c]\r",bar,cnt,ch[len%4]);
        fflush(stdout);

        bar[cnt++]=BODY;    //设置进度条样式
        if(cnt<100) bar[cnt]=TOP;   //设置进度条头样式
        usleep(SLEEPTIME);
    }
    printf("\n");
}

void Clear()
{
    memset(bar,'\0',sizeof(bar));
}
